package com.wlhse.controller;
import com.wlhse.service.ChangQinCompanyService;
import com.wlhse.util.GetCurrentUserIdUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController("ChangQinCompanyController")
@RequestMapping("api/v1")
public class ChangQinCompanyController {

    @Resource
    private ChangQinCompanyService changQinCompanyService;

    @Resource
    private GetCurrentUserIdUtil getCurrentUserIdUtil;

    @RequestMapping(value = "/chang_qin/company/tree", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String getCompanyTree() {
        return changQinCompanyService.listTreeCompany().toJSONString();
    }

    @RequestMapping(value = "/chang_qin/company/tree/current", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String getCurrentCompanyTree(HttpServletRequest request) {
//        checkRecordInDto.setVerifyPersonEmpID(getCurrentUserIdUtil.getUserId(request));
        return changQinCompanyService.listCurrentTreeCompany(getCurrentUserIdUtil.getUserId(request)).toJSONString();
    }


}
